<template>
	<view class="container">
		<view class="integrallist row" v-for="item in intlist" :key="index">
			<view class="integraxiao">消费{{item.description}}元</view>
			<view class="integratime" >{{item.time}}</view>
			<view class="integrajif">{{item.money}}积分</view>
		</view>
		<view class="mode">{{tishi_title}}</view>
	</view>
</template>

<script>
	var app=getApp();
	import http from '@/common/js/request.js'
	export default {
		data() {
			return {
				url:app.globalData.baseImgUrl,
				userInfo:"",
				intlist:[],
				currentPage:1,
				tishi_title:""
				
			}
		},
		onLoad() {
			var that=this;
			that.getUserInfo();
			that.IntegralLogList();
		},
		methods: {
			//用户信息
			getUserInfo() {
				var that = this;
				http.post('/api/v1/member/member_info', {}, res => {
					that.userInfo = res.datas;
				});
			},
			//积分列表
			IntegralLogList(){
				var that=this;
				http.post("/api/v1/store/integral_log",{
					store_id: app.globalData.storeId,
					page:that.currentPage,
				},function(res){
					console.log(res)
					
					var allpost = that.intlist;
					if (allpost == undefined) {
						allpost = [];
					}
					for (var i in res.datas) {
						allpost.push(res.datas[i])
					}
					if (res.datas.length < 10) {
						that.tishi_title = "已加载全部"
					} else {
						that.tishi_title = "正在加载中..."
					}
					that.intlist=allpost;
					that.ready = res.datas.length == 0 ? 1 : 2;
				})
			},
			onReachBottom() {
				var that = this;
				if (that.ready == 2) {
					that.currentPage = that.currentPage + 1
					that.IntegralLogList();
				}
			},
			onPullDownRefresh() {
				var that = this;
				that.intlist = [];
				that.currentPage = 1;
				that.IntegralLogList();
				setTimeout(function() {
					uni.stopPullDownRefresh();
				}, 500);
			}
			
		}
	}
</script>

<style>
	.integrallist{
		padding: 32rpx;
		height: 114rpx;
		line-height: 114rpx;
		border-bottom: 1px solid #EEEEEE;
	}
	.integrallist:last-child{
		border-bottom: 0!important;
	}
	.integrallist image{
		width: 114rpx;
		height: 114rpx;
		border-radius:50%;
		display: block;
	}
	.integraxiao{
		width:360rpx;
		padding-left: 20rpx;
		font-size: 36rpx;
		color: #FF9D11;
		font-size: 28rpx;
	}
	.integrajif{
		width: 200rpx;
		text-align: right;
		color: #FF703E;
		font-size: 36rpx;
	}
	.integratime{
		font-size:30rpx;	
		line-height:53rpx;
		}
	
</style>
